package com.javase.Homework;

public class Homework02 {
    public static void main(String[] args) {
        String[] arr = {"hello","world","name"};
        A02 a02 = new A02();
        System.out.println(a02.find(arr,"name"));
    }
}

class A02{
    public int find(String[] arr,String str){
        int index = -1;
        for (int i = 0;i < arr.length;i++){
            if (str.equals(arr[i])){
                index = i;
            }
        }
        return index;
    }
}
